import React from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import {createStore, applyMiddleware, compose} from 'redux'
import { BrowserRouter,Route,Switch } from 'react-router-dom'

import reducers from './reducer'
import './config'
import './index.css'

import Register from './container/register/register';
import Login from './container/login/login';
import AuthRoute from './components/authroute/authroute'
import BossInfo from './container/bossinfo/bossinfo'
import GeniusInfo from './container/geniusinfo/geniusinfo'
import Dashboard from './components/dashboard/dashboard'
import Chat from './components/Chat/Chat'
const store = createStore(reducers, compose(
    applyMiddleware(thunk)
))


ReactDom.render(
    (<Provider store={store}>
        <BrowserRouter>
            <div>
                <AuthRoute></AuthRoute>
                <Switch>
                    <Route path='/bossinfo' component={BossInfo}/>
                    <Route path='/geniusinfo' component={GeniusInfo}/>
                    <Route path='/login' component={Login}/>
                    <Route path='/register' component={Register}/>
                    <Route path='/chat/:user' component={Chat}/>
                    <Route component={Dashboard}></Route>
                </Switch>
                
            </div>
        </BrowserRouter>
    </Provider>), 
document.getElementById('root')
)

